libobs_wrapper\data\properties\types/
path.rs

1use getters0::Getters;
2
3use crate::data::properties::{get_enum, get_opt_str, macros::assert_type, ObsPathType};
4
5use super::PropertyCreationInfo;
6
7#[derive(Debug, Getters, Clone)]
8#[skip_new]
9pub struct ObsPathProperty {
10    name: String,
11    description: Option<String>,
12    path_type: ObsPathType,
13    filter: String,
14    default_path: String,
15}
16
17impl From<PropertyCreationInfo> for ObsPathProperty {
18    fn from(PropertyCreationInfo { name, description, pointer }: PropertyCreationInfo) -> Self {
19        assert_type!(Path, pointer);
20
21        let path_type = get_enum!(pointer, path_type, ObsPathType);
22        let filter = get_opt_str!(pointer, path_filter).unwrap_or_default();
23        let default_path = get_opt_str!(pointer, path_default_path).unwrap_or_default();
24        Self {
25            name,
26            description,
27            path_type,
28            filter,
29            default_path,
30        }
31    }
32}